package com.cangxuan.backend.dao;

import com.cangxuan.backend.entity.Goods;
import com.cangxuan.backend.entity.MarketGoods;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * goods表访问接口
 */
@Mapper
public interface IGoodsDao {


    List<Goods> select(@Param("pageIndex") int pageIndex,
                       @Param("pageSize") int pageSize,
                       @Param("name") String name,
                       @Param("code") String code);

    List<Goods> selectHomeCollections(@Param("pageIndex") int pageIndex,
                                      @Param("pageSize") int pageSize);

    int selectCount(@Param("name") String name,
                    @Param("code") String code);


    Goods selectById(Integer id);

    List<MarketGoods> selectMarketCollection(@Param("searchKey") String searchKey,
                                             @Param("category") int category,
                                             @Param("priceSort") int priceSort,
                                             @Param("releaseDateSort") int releaseDateSort,
                                             @Param("issuers") Integer[] issuers,
                                             @Param("series") Integer[] series,
                                             @Param("pageIndex") Integer pageIndex,
                                             @Param("pageSize") Integer pageSize);

    int selectMarketOrderCount(@Param("goodsId") int goodsId);

    Goods selectGoodsByIdForUpdate(Integer goodsId);

    int updateCirculation(@Param("goodsId") Integer goodsId, @Param("count") Integer count);

    int updateCount(@Param("goodsId") Integer goodsId, @Param("count") Integer count);


    List<Goods> selectHomeCalendar(@Param("pageIndex") Integer pageIndex, @Param("pageSize") Integer pageSize);

}
